package com.yaperviy.webapp.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.yaperviy.model.Brand;
import com.yaperviy.service.GenericManager;

@Controller
@RequestMapping("/brands*")
public class BrandController {
	private GenericManager<Brand, Long> brandManager;

	@Autowired
	public void setBrandManager(@Qualifier("brandManager") GenericManager<Brand, Long> brandManager) {
        this.brandManager = brandManager;
    }

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView handleRequest() throws Exception {
        return new ModelAndView().addObject(brandManager.getAll());
    }

}
